"""
URL configuration for k8s_api project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include, re_path
from django.views.static import serve
from k8s_api import views
from k8s_api import settings

urlpatterns = [
    # path('admin/', admin.site.urls),
    path('user/', include('user.urls')),  # 用户模块
    path('role/', include('role.urls')),  # 角色模块
    path('menu/', include('menu.urls')),  # 权限模块
    path('k8s/', include('k8s.urls')), # k8s模块
    path('workload/', include('workload.urls')), # workload模块
    path('loadbalancer/', include('loadbalancer.urls')), # loadbalancer模块
    path('storage/', include('storage.urls')), # storage模块
    path('rbac/', include('rbac.urls')),  # rbac模块
    path('export_yaml/', views.export_yaml.as_view(), name='export_yaml'), #导出YAML
    path('apply_yaml/', views.apply_yaml.as_view(), name='apply_yaml'), #更新YAML
    path('ace_editor_apply_yaml/', views.ace_editor_apply_yaml.as_view(), name='ace_editor_apply_yaml'), #应用YAML
    path('node_resource/', views.node_resource.as_view(), name='node_resource'), #节点资源统计
    # 配置媒体文件的路由地址
    re_path('media/(?P<path>.*)', serve, {'document_root': settings.MEDIA_ROOT}, name='media')
]
